using System;

namespace Gltf
{
    class AccessorWriter<T> where T : unmanaged
    {
        private AccessorView<T> _accessor;

        public AccessorWriter()
        {
            _accessor = new AccessorView<T>();
        }

        /** @copydoc AccessorView::AccessorView(const
         * uint8_t*,Int64,Int64,Int64) */
        public AccessorWriter(byte[] pData, Int64 stride, Int64 offset, Int64 size)
        {
            _accessor = new AccessorView<T>(pData, stride, offset, size);
        }


        /** @copydoc AccessorView::AccessorView(const Model&,const Accessor&) */
        public AccessorWriter(Model model, Accessor accessor)
        {
            _accessor = new AccessorView<T>(model, accessor);
        }


        /** @copydoc AccessorView::AccessorView(const Model&,int32_t) */
        public AccessorWriter(Model model, int accessorIndex)
        {
            _accessor = new AccessorView<T>(model, accessorIndex);
        }
        public T this[int i]
        {
            get
            {
                return this._accessor[i];
            }
            set
            {
                this._accessor[i] = value;
            }
        }

        /** @copydoc AccessorView::operator[]() */
        // const T& operator[] (Int64 i) const { return this->_accessor[i]; }

        /** @copydoc AccessorView::operator[]() */
        // T& operator[](Int64 i) { return const_cast < T &> (this->_accessor[i]); }

        /** @copydoc AccessorView::size */
        public Int64 size()
        { return this._accessor.size(); }

        /**
         * @brief Gets the status of this accessor writer.
         *
         * Indicates whether the writer accurately reflects the accessor's data, or
         * whether an error occurred.
         */
        AccessorViewStatus status()
        {
            return this._accessor.status();
        }
    };
}